<?php
include_once("{$_SERVER['DOCUMENT_ROOT']}/CommonClasses/MySQLDAO.php");
include("SignUpBean.php");

class SignUpDAO extends MySQLDAO {
	protected function lookupSqlById($id) {
		switch($id) {
			case "SELECT_ALL":
				return "select username,event_id,signup_datetime,email_user from signups";
				break;
			case "SELECT_EVENT_ID":
				return "select username,event_id,signup_datetime,email_user from signups where event_id = {0}";
				break;
			default:
				return "";
				break;		
		}
	}
	
	protected function bindParameters($id,$paramBean) {
		switch($id) {
			case "SELECT_EVENT_ID":
				$params[0] = $this->bindString($paramBean->getEventId());
				break;
		}
		
		return $params;
	}

	protected function loadBean($id,$row,$rows) {
		$bean = new SignUpBean();

		switch($id) {
			default:
				$bean->setUsername($row['username']);
				$bean->setEventId($row['event_id']);
				$bean->setSignUpDateTime($row['signup_datetime']);
				$bean->setEmailUser($row['email_user']);
				break;
		}

		array_push($rows,$bean);
		return $rows;
	}
	
	protected function getDbPropertiesFile($file="") {
		parent::getDbPropertiesFile("SignUpDb.properties");
	}
}
?>